import './assets/styles'

import Vue from 'vue'

import App from './App.vue'
import { useElementUI, useErrorHandler } from './hooks'
import router from './router'

Vue.config.productionTip = false

useElementUI(Vue)
useErrorHandler(Vue)

let app: Nullable<Vue> = null

if (window.__POWERED_BY_WUJIE__) {
  window.__WUJIE_MOUNT = () => {
    app = new Vue({ router, render: h => h(App) })
    app.$mount('#app')
  }
  window.__WUJIE_UNMOUNT = () => {
    app?.$destroy()
  }
  // module脚本异步加载，应用主动调用生命周期
  window.__WUJIE.mount()
} else {
  app = new Vue({ router, render: h => h(App) })
  app.$mount('#app')
}
